<?php

namespace app\common\model;

use think\Model;

class WalletLog extends Model
{

    protected $autoWriteTimestamp = true;
    public function getTypeAttr($value)
    {
        $status = [
            1 => '提现扣除',2=>'提现失败返还', 3=>'余额兑换增加', 4=>'邀请佣金', 5=>'推广佣金'
        ];
        return $status[$value]; 
    } 
    protected $append = [

        'nickname',

    ];
    public function getNicknameAttr($value)
    {
        if($this->User){
            return $this->User->getData('nickname');
        }else{
            return '';
        }
        
    }
    public function User()
    {
        return $this->belongsTo('User', 'userid', 'id');
    }
}
